#include "../Models/MGate.h"


MGate::MGate() : MCase()
{
}

MGate::MGate(int x, int y, QString ip, quint16 port) : MCase(x, y)
{
    int i;
    const char *temp;

    this->type = MCASE_GATE;
    temp = ip.toStdString().c_str();
    i = 0;
    while (temp[i] != '\0' && i < 255)
    {
        this->ip[i] = temp[i];
        i += 1;
    }
    this->ip[i] = '\0';
    this->port = port;
}

MGate::~MGate()
{
}

MGate &MGate::operator=(MGate const &gate)
{
    int i;

    this->x = gate.x;
    this->y = gate.y;
    this->type = gate.type;
    i = 0;
    while (gate.ip != '\0' && i < 63)
    {
        this->ip[i] = gate.ip[i];
        i += 1;
    }
    this->ip[i] = '\0';
    this->port = gate.port;
    return *this;
}
